{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "原文链接：https://www.cnblogs.com/l520/p/10254905.html\n",
    "\n",
    "画爱心表白\n",
    "\n",
    "\n",
    "\n",
    "1、图形都是由一系列的点(X，Y)构成的曲线，由于X，Y满足一定的关系，所以我们就可以建立模型，建立表达式expression，当满足时，两个for循环（for X in range；for Y in range）就会每行每列的打印。\n",
    "\n",
    "'''\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Please input the words that you want to sayLove\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "import time\n",
    "\n",
    "words = input('Please input the words that you want to say：')\n",
    "for item in words.split():\n",
    "    # 实现打印字符间空格效果 ，此处添加 item = item+ \" \"\n",
    "    letterList = []# 是打印所以字符的总list，里面包含 y 条子列表list_x\n",
    "    \n",
    "    for y in range(12,-12,-1):\n",
    "        list_x = []# list_x是x轴上打印的所以字符列表，里面装着一个String类的letters\n",
    "        letters = ''# list_x内的字符串，实际是本行打印的所有字符串\n",
    "        \n",
    "        for x in range(30,-30):# * 是乘，**是次幂\n",
    "            experssion = ((x*0.05)**2+(y*0.01)**2-1)**3 - (x * 0.05)**2*(y*0.1)**3\n",
    "            if experssion <= 0:\n",
    "                letters += item[(x -y) %len(item)]\n",
    "            else:\n",
    "                letters +=' '\n",
    "                \n",
    "        list_x.append(letters)\n",
    "        letterList += list_x\n",
    "        print('\\n'.join(letterList))\n",
    "        time.sleep(1.5)\n",
    "                \n",
    "            \n",
    "        \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "\n",
    "快递查询工具\n",
    "\n",
    " 此Python小项目需要用到json与requests两个库，还需调用API。\n",
    "\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json,requests\n",
    "\n",
    "def searchPackage():\n",
    "    # 只有正在运途中的可以查询\n",
    "    packageNum = input('请输入运单号：')\n",
    "    url_1 = 'https://www.kuaidi100.com/autonumber/autoComNum?resultv2 =1&text='+packageNum\n",
    "    \n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 2 3\n",
      "1 2 4\n",
      "1 3 2\n",
      "1 3 4\n",
      "1 4 2\n",
      "1 4 3\n",
      "2 1 3\n",
      "2 1 4\n",
      "2 3 1\n",
      "2 3 4\n",
      "2 4 1\n",
      "2 4 3\n",
      "3 1 2\n",
      "3 1 4\n",
      "3 2 1\n",
      "3 2 4\n",
      "3 4 1\n",
      "3 4 2\n",
      "4 1 2\n",
      "4 1 3\n",
      "4 2 1\n",
      "4 2 3\n",
      "4 3 1\n",
      "4 3 2\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "\n",
    "题目：有四个数字：1、2、3、4，能组成多少个互不相同且无重复数字的三位数？各是多少？\n",
    "\n",
    "'''\n",
    "\n",
    "\n",
    "for i in range(1,5):\n",
    "    for j in range(1,5):\n",
    "        for k in range(1,5):\n",
    "            if(i != j) &(j != k) & (i != k):\n",
    "                print(i,j,k)\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "净利润：120000\n",
      "1500.0\n",
      "10000.0\n",
      "11500.0\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "\n",
    "\n",
    "：企业发放的奖金根据利润提成。利润(I)低于或等于10万元时，奖金可提10%；利润高于10万元，低于20万元时，低于10万元的部分按10%提成，\n",
    "\n",
    "高于10万元的部分，可提成7.5%；20万到40万之间时，高于20万元的部分，可提成5%；40万到60万之间时高于40万元的部分，可提成3%；60万到100万之间时，\n",
    "\n",
    "高于60万元的部分，可提成1.5%，高于100万元时，超过100万元的部分按1%提成，从键盘输入当月利润I，求应发放奖金总数？\n",
    "\n",
    "\n",
    "'''\n",
    "\n",
    "\n",
    "\n",
    "i = int(input('净利润：'))\n",
    "\n",
    "arr = [1000000,600000,400000,200000,100000,0]\n",
    "rat = [0.01,0.015,0.03,0.05,0.075,0.1]\n",
    "r = 0\n",
    "\n",
    "for idx in range(0,6):\n",
    "    if i > arr[idx]:\n",
    "        r += (i - arr[idx]) * rat[idx]\n",
    "        print((i - arr[idx]) * rat[idx])\n",
    "        i = arr[idx]\n",
    "        \n",
    "print(r)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-99.0\n",
      "21.0\n",
      "261.0\n",
      "1581.0\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "\n",
    "一个整数，它加上100后是一个完全平方数，再加上168又是一个完全平方数，请问该数是多少？\n",
    "\n",
    "'''\n",
    "\n",
    "\n",
    "for i in range(1,85):\n",
    "    if 168 % i == 0:\n",
    "        j = 168 / i;\n",
    "        if  i > j and (i + j) % 2 == 0 and (i - j) % 2 == 0 :\n",
    "            m = (i + j) / 2\n",
    "            n = (i - j) / 2\n",
    "            x = n * n - 100\n",
    "            print(x)\n",
    "        \n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "year:\n",
      "2019\n",
      "month:\n",
      "8\n",
      "day:\n",
      "23\n",
      "it is the 235th day.\n"
     ]
    }
   ],
   "source": [
    "\n",
    "'''\n",
    "题目：输入某年某月某日，判断这一天是这一年的第几天？\n",
    "\n",
    "程序分析：以3月5日为例，应该先把前两个月的加起来，然后再加上5天即本年的第几天，特殊情况，闰年且输入月份大于2时需考虑多加一天：\n",
    "\n",
    "程序源代码：\n",
    "\n",
    "'''\n",
    "\n",
    "\n",
    "\n",
    "year = int(input('year:\\n'))\n",
    "month = int(input('month:\\n'))\n",
    "day = int(input('day:\\n'))\n",
    " \n",
    "months = (0,31,59,90,120,151,181,212,243,273,304,334)\n",
    "if 0 < month <= 12:\n",
    "    sum = months[month - 1]\n",
    "else:\n",
    "    print( 'data error')\n",
    "sum += day\n",
    "leap = 0\n",
    "if (year % 400 == 0) or ((year % 4 == 0) and (year % 100 != 0)):\n",
    "    leap = 1\n",
    "if (leap == 1) and (month > 2):\n",
    "    sum += 1\n",
    "print( 'it is the %dth day.' % sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "integer\n",
      "5\n",
      "integer\n",
      "7\n",
      "integer\n",
      "2\n",
      "[2, 5, 7]\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "\n",
    "输入三个整数x,y,z，请把这三个数由小到大输出。\n",
    "\n",
    "'''\n",
    "listNum = []\n",
    "for i in range(3):\n",
    "    x = int(input('integer\\n'))\n",
    "    listNum.append(x)\n",
    "    \n",
    "listNum.sort()\n",
    "print(listNum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
